package com.yxjx.duoxue.payment;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.datamodel.DMObject;
import com.yxjx.duoxue.utils.UIHelper;

public class ConfigKidsDetailDTS extends DMObject implements Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = -6626830348738709233L;
	private Integer id;
    private String kidsDes;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getKidsDes() {
        return kidsDes;
    }

    public void setKidsDes(String kidsDes) {
        this.kidsDes = kidsDes;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        result = prime * result + ((kidsDes == null) ? 0 : kidsDes.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ConfigKidsDetailDTS other = (ConfigKidsDetailDTS) obj;
        if (id == null) {
            if (other.id != null)
                return false;
        } else if (!id.equals(other.id))
            return false;
        if (kidsDes == null) {
            if (other.kidsDes != null)
                return false;
        } else if (!kidsDes.equals(other.kidsDes))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "{\"id\":\"" + id + "\", \"kidsDes\":\"" + kidsDes + "\"}";
    }
    
    /**
     * Json str 2 object
     * @param str
     * @return
     */
    public static ConfigKidsDetailDTS from(String str) {
    	if (UIHelper.isEmpty(str)) {
    		return null;
    	}
    	
    	try {
			JSONObject jo = new JSONObject(str);
			ConfigKidsDetailDTS item = new ConfigKidsDetailDTS();
			item.setId(castInteger(jo,"id"));
			item.setKidsDes(castString(jo,"kidsDes"));
			return item;
		} catch (JSONException e) {
			e.printStackTrace();
		}
    	return null;
    }

}
